package com.ruoyi.admin.service.impl;

import java.util.List;

import com.ruoyi.admin.domain.vo.ExperimentrequestVo;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.admin.mapper.ExperimentrequestMapper;
import com.ruoyi.admin.domain.Experimentrequest;
import com.ruoyi.admin.service.IExperimentrequestService;

/**
 * 实验课申请Service业务层处理
 * 
 * @author lin
 * @date 2024-04-20
 */
@Service
public class ExperimentrequestServiceImpl implements IExperimentrequestService 
{
    @Autowired
    private ExperimentrequestMapper experimentrequestMapper;

    /**
     * 查询实验课申请
     * 
     * @param requestId 实验课申请主键
     * @return 实验课申请
     */
    @Override
    public ExperimentrequestVo selectExperimentrequestByRequestId(Long requestId)
    {
        return experimentrequestMapper.selectExperimentrequestByRequestId(requestId);
    }

    /**
     * 查询实验课申请列表
     * 
     * @param experimentrequest 实验课申请
     * @return 实验课申请
     */
    @Override
    public List<ExperimentrequestVo> selectExperimentrequestList(Experimentrequest experimentrequest)
    {

        return experimentrequestMapper.selectExperimentrequestList(experimentrequest);
    }

    /**
     * 新增实验课申请
     * 
     * @param experimentrequest 实验课申请
     * @return 结果
     */
    @Override
    public int insertExperimentrequest(Experimentrequest experimentrequest)
    {
        experimentrequest.setTeacherId(SecurityUtils.getLoginUser().getUser().getUserId());
        return experimentrequestMapper.insertExperimentrequest(experimentrequest);
    }

    /**
     * 修改实验课申请
     * 
     * @param experimentrequest 实验课申请
     * @return 结果
     */
    @Override
    public int updateExperimentrequest(Experimentrequest experimentrequest)
    {
        experimentrequest.setTeacherId(SecurityUtils.getLoginUser().getUser().getUserId());
        return experimentrequestMapper.updateExperimentrequest(experimentrequest);
    }

    /**
     * 批量删除实验课申请
     * 
     * @param requestIds 需要删除的实验课申请主键
     * @return 结果
     */
    @Override
    public int deleteExperimentrequestByRequestIds(Long[] requestIds)
    {
        return experimentrequestMapper.deleteExperimentrequestByRequestIds(requestIds);
    }

    /**
     * 删除实验课申请信息
     * 
     * @param requestId 实验课申请主键
     * @return 结果
     */
    @Override
    public int deleteExperimentrequestByRequestId(Long requestId)
    {
        return experimentrequestMapper.deleteExperimentrequestByRequestId(requestId);
    }
}
